home *** CD-ROM | disk | FTP | other *** search
- Path: lrz-muenchen.de!news
- From: watzka@stat.uni-muenchen.de (Kurt Watzka)
- Newsgroups: comp.lang.c
- Subject: Re: Function pointers; example code
- Date: 17 Feb 1996 18:48:51 GMT
- Organization: Leibniz-Rechenzentrum, Muenchen (Germany)
- Distribution: world
- Message-ID: <4g57uj$9iq@sparcserver.lrz-muenchen.de>
- References: <DMwzBL.HDt@ichaos.nullnet.fi>
- NNTP-Posting-Host: sun2.lrz-muenchen.de
-
- jlaiho@ichaos.nullnet.fi (Juha Laiho) writes:
-
- >Here's a short program I wrote as an example of function pointers. I'd
- >appreciate _any_ comments about it.
-
- >---SNIP---
- >#include <stdio.h>
-
- >typedef void f(int); /* f is a type that is a function taking one int
- > * argument and returning an int
- > */
-
- No, it is a function taking one int argument and returning nothing,
- hence the "void" in front of the "f".
-
- >typedef f *ptf; /* ptf is a type that is a pointer to a function */
- >typedef ptf aptf[]; /* aptf is a type that is an array of ptfs */
-
- >f a, b, c; /* Define three functions a, b and c; each is 'void f(int)' */
-
- You did not define them, but you declared them.
-
- [code that defined main and a, b, and c edited]
-
- Kurt
- --
- | Kurt Watzka Phone : +49-89-2180-6254
- | watzka@stat.uni-muenchen.de
- | ua302aa@sunmail.lrz-muenchen.de
-